class AgeException extends Exception {
    public AgeException(String message) {
        super(message);
    }
}

class Person {
    private String name;
    private int age;
    public Person(String name, int age) throws AgeException {
        if (age < 0 || age > 150) {
            throw new AgeException("年龄数值非法");
        }
        this.name = name;
        this.age = age;
    }
    public String toString() {
        return "姓名：" + name + "，年龄：" + age;
    }
}

public class Test {
    public static void main(String[] args) {
        try {
            Person per = new Person("马鑫冰", 18);
            System.out.println(per);
        } catch (AgeException e) {
            System.out.println("发生异常：" + e.getMessage());
        }
    }
}
